using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ProductionJobsMap : EntityTypeConfiguration<so_ProductionJobs>
    {
        public so_ProductionJobsMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Sales_Item_Id, t.Job__, t.Quantity, t.Unit_Cost, t.Invoice__, t.Work_Order });

            // Properties
            this.Property(t => t.Sales_Item_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Job__)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Classification)
                .HasMaxLength(9);

            this.Property(t => t.Worker_vendor)
                .HasMaxLength(35);

            this.Property(t => t.Status)
                .HasMaxLength(40);

            this.Property(t => t.Invoice__)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Invoice_Batch)
                .HasMaxLength(8);

            // Table & Column Mappings
            this.ToTable("so_ProductionJobs");
            this.Property(t => t.Sales_Item_Id).HasColumnName("Sales_Item_Id");
            this.Property(t => t.Job__).HasColumnName("Job_#");
            this.Property(t => t.Classification).HasColumnName("Classification");
            this.Property(t => t.Worker_vendor).HasColumnName("Worker/vendor");
            this.Property(t => t.Duration_Days_).HasColumnName("Duration(Days)");
            this.Property(t => t.Quantity).HasColumnName("Quantity");
            this.Property(t => t.Unit_Cost).HasColumnName("Unit_Cost");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.VAT).HasColumnName("VAT");
            this.Property(t => t.Order_Date).HasColumnName("Order_Date");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Invoice__).HasColumnName("Invoice_#");
            this.Property(t => t.Invoice_Date).HasColumnName("Invoice_Date");
            this.Property(t => t.Invoice_Batch).HasColumnName("Invoice_Batch");
            this.Property(t => t.Work_Order).HasColumnName("Work_Order");
        }
    }
}
